<?php
    header("content-type:text/html;charset=utf8");
    $username = $_POST['username'];
    $password = $_POST['password'];
    $con = mysqli_connect('localhost','root','root','info');
    $res = mysqli_query($con,"select * from user where username = '$username'");
    $row = mysqli_fetch_assoc($res);
    if($row) {
        if($row['password'] == $password) {
            $arr = [
                "meta" => [
                    "status" => 201,
                    "msg" => "登陆成功"
                ],
                "data" => null
            ];
        }else {
            $arr = [
                "meta" => [
                    "status" => 202,
                    "msg" => "密码错误"
                ],
                "data" => null
            ];
        }
    }else {
        $arr = [
            "meta" => [
                "status" => 203,
                "msg" => "用户名不存在"
            ],
            "data" => null
        ];
    }
    echo json_encode($arr);